var e = require("../../utils/request"), t = require("../../utils/api");

Page({
    data: {
        activeNames: [],
        faqList: [],
        phoneHeight: 1e3,
        pageIndex: 1,
        pageSize: 20,
        totalSize: 0,
        showDivder: !1
    },
    onLoad: function() {
        this.getPhoneHeight(), this.selectWcaCommonProblemByPage();
    },
    onChange: function(e) {
        this.setData({
            activeNames: e.detail
        });
    },
    getPhoneHeight: function() {
        var e = this;
        wx.getSystemInfo({
            success: function(t) {
                e.setData({
                    phoneHeight: t.windowHeight
                });
            }
        });
    },
    selectWcaCommonProblemByPage: function() {
        var a = this;
        wx.showLoading({
            title: "正在加载中...",
            mask: !0
        });
        var i = "isDelete=false&pageIndex=" + this.data.pageIndex + "&pageSize=" + this.data.pageSize;
        e.request(e.HttpMethod.GET, t.apiRoute.selectWcaCommonProblemByPage + i, {}).then(function(e) {
            if ("20000" == e.code) {
                var t = a.data.faqList.concat(e.data.records);
                a.setData({
                    faqList: t,
                    totalSize: e.data.total
                }), wx.hideLoading();
            } else wx.hideLoading();
        });
    },
    onScrollLower: function() {
        var e = this.data.pageIndex + 1;
        (e - 1) * this.data.pageSize > this.data.totalSize ? this.setData({
            showDivder: !0
        }) : (this.setData({
            pageIndex: e
        }), this.selectWcaCommonProblemByPage());
    }
});